using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Diagnostics;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using UIProcessSchemaObjects;

namespace UIProcessActivities
{
    [Designer(typeof(LoadFormDesigner), typeof(IDesigner))]
    public partial class LoadForm : SequenceActivity
	{
		public LoadForm()
		{
			InitializeComponent();
		}

        public static DependencyProperty FormProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Form", typeof(UIProcessSchemaObjects.Form), typeof(LoadForm));

        [Description("The Form loaded by the activity")]
        [Category("Output")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public UIProcessSchemaObjects.Form Form
        {
            get
            {
                return ((UIProcessSchemaObjects.Form)(base.GetValue(LoadForm.FormProperty)));
            }
            set
            {
                base.SetValue(LoadForm.FormProperty, value);
            }
        }

        public static DependencyProperty FilePathProperty = System.Workflow.ComponentModel.DependencyProperty.Register("FilePath", typeof(string), typeof(LoadForm));

        [Description("This is the path to the where the Form is stored on disk.")]
        [Category("Input")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public string FilePath
        {
            get
            {
                return ((string)(base.GetValue(LoadForm.FilePathProperty)));
            }
            set
            {
                base.SetValue(LoadForm.FilePathProperty, value);
            }
        }

        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            this.Form = FormHelper.LoadForm(this.FilePath);
            return ActivityExecutionStatus.Closed;
        }
	}
}
